﻿#include "TcpCodec_MCUCtl.h"

#include "TcpCodec.h"
#include "MCUCodec.h"

TcpCodec_MCUCtl::TcpCodec_MCUCtl()
{
setObjectName(getClassNameFirstLow<TcpCodec_MCUCtl>());
}

TcpCodec_MCUCtl::~TcpCodec_MCUCtl()
{

}

void TcpCodec_MCUCtl::decode(DataPackage_TcpCodec* dataPackageInfo_User)
{
  mCUCodec->decode(dataPackageInfo_User->getData());
}

TcpCodec* TcpCodec_MCUCtl::getTcpCodec()const
{
  return tcpCodec;
}

TcpCodec_MCUCtl* TcpCodec_MCUCtl::setTcpCodec(TcpCodec* const tcpCodec)
{
  this->tcpCodec=tcpCodec;
  tcpCodec->addToCodecMap(TcpCodec_MCUCtl::MCUCtl,this);
  printInjection(this,tcpCodec);
  return this;
}

MCUCodec* TcpCodec_MCUCtl::getMCUCodec()const
{
  return mCUCodec;
}

TcpCodec_MCUCtl* TcpCodec_MCUCtl::setMCUCodec(MCUCodec* const mCUCodec)
{
  this->mCUCodec=mCUCodec;
  printInjection(this,mCUCodec);
  return this;
}

void TcpCodec_MCUCtl::objectAutoInjection(QHash<QString,QObject*>* objMap)
{
  setTcpCodec(getObjFromMap<TcpCodec>(objMap));
  setMCUCodec(getObjFromMap<MCUCodec>(objMap));
}
